﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

namespace JJYYCore
{
    public class EventsDictionary
    {
        private Dictionary<string, Action> actions;

        public void Add(string id, Action action) => actions.Add(id, action);
        public void RemoveEvent(string id)
        {
            if (actions.ContainsKey(id))
                actions.Remove(id);
        }

        public void FireEvent(string id)
        {
            if (actions.ContainsKey(id))
                actions[id]();
        }

        public EventsDictionary()
        {
            actions = new Dictionary<string, Action>();
        }
    }
}